<?php
apf_require_class("Bll_BLL");
class Bll_Attendance_MonthSpecialSet extends BLL{

    /**
     * 获得月份的实际结算日
     */
    public function get_month_special_set($yearmonth = 0) {
        $list = array(
                201207=>array('settlement'=>20120728,'daylist'=>array()),
                201208=>array('settlement'=>20120828,'daylist'=>array()),
                201209=>array('settlement'=>20120928,'daylist'=>array()),
                201210=>array('settlement'=>20121028,'daylist'=>array()),
        );
        if(empty($yearmonth)) {
            $yearmonth = date('Ym');
        }
        if(!isset($list[$yearmonth])){//以后的计算方式从1-月最后一天
            $month = intval(substr($yearmonth,4,2));
            $start_unix = mktime(0,0,0,$month+1,0,substr($yearmonth,0,4));
            return array(
                    'settlement'=>date("Ymd",$start_unix),
                    'daylist'=>array()
                    );
        }
        return $list[$yearmonth];
        $rs = $this->get_month_special_dao()->find_by_id($yearmonth);
        if(empty($rs)){
            return array(
                    'settlement'=>$yearmonth.'28',
                    'daylist'=>array()
                    );
        }
        $data = array();
        foreach($rs as $val){
            if(!empty($val)){
                $data['settlement'] = $val['settlement'];
            }else{
                $data['daylist'] = $val['workday'];
            }
        }
        return $rs;
    }
    /**
     * @return Dao_Attendance_MonthSpecialSet
     */
    private function get_month_special_dao(){
        $dao = $this->get_dao('Dao_Attendance_MonthSpecialSet');
        return $dao;
    }
}